<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../templates/FoodSageTemplate.xhtml">
 
    <ui:define name="logout">
        <p:commandLink id="logoutLink" actionListener="#{touristLogoutManagedBean.doLogout}" value="#{bundle['login.logout.label']}" ajax="false" immediate="true" />
    </ui:define>
 
    <ui:define name="main_menu">
        <p:menubar model="#{touristEditMyFoodSageManagedBean.touristMainMenuModel}"/>
    </ui:define>
 
    <ui:define name="nav_menu">
        <p:menu model="#{touristEditMyFoodSageManagedBean.touristNavMenuModel}"/>
    </ui:define>
    
    <ui:define name="content">
        <f:view beforePhase="#{touristEditMyFoodSageManagedBean.initView}" >
            <p:panel id="touristAccountDetail" header="#{bundle['myfoodsage.header.panel']}"  >
                <p:messages id="statusMessages" />

                <p:tabView id="tabViewTouristView" dynamic="false">

                    <p:tab id="tabTouristAccountInfo" title="#{bundle['myfoodsage.accountinfo.tab']}">
                        <h:panelGrid columns="3" cellpadding="5">
                            <h:outputLabel id="touristAccountUsernameLabel" value="#{bundle['myfoodsage.username.label']}" style="font-weight: bold"/>
                            <h:outputLabel id="username" value="#{touristEditMyFoodSageManagedBean.username}" />
                            <p:message for="username" />

                            <h:outputLabel id="touristAccountCurrentPasswordLabel" value="#{bundle['myfoodsage.currentpassword.label']}" style="font-weight: bold"/>
                            <p:password id="currpassword" value="#{touristEditMyFoodSageManagedBean.currentPassword}" feedback="false" minLength="1" /> 
                            <p:message for="currpassword" />

                            <h:outputLabel id="touristAccountNewPasswordLabel" value="#{bundle['myfoodsage.newpassword.label']}" style="font-weight: bold"/>
                            <p:password id="newpassword" value="#{touristEditMyFoodSageManagedBean.newPassword}" binding="#{pw}" feedback="true" minLength="6" /> 
                            <p:message for="newpassword" />

                            <h:outputLabel id="touristAccountConfirmPasswordLabel" value="#{bundle['myfoodsage.confirmpassword.label']}" style="font-weight: bold" />
                            <p:password id="confirmpassword" value="#{touristEditMyFoodSageManagedBean.confirmPassword}" feedback="true" minLength="6" >
                                <f:validator validatorId="matchPassword" />
                                <f:attribute name="pw" value="#{pw}" />
                            </p:password>
                            <p:message for="confirmpassword" />

                            <h:outputLabel id="touristAccountLanguageLabel" value ="#{bundle['myfoodsage.languagepreferred.label']}" style="font-weight: bold"/>
                            <h:selectOneMenu id="language" value="#{touristEditMyFoodSageManagedBean.language}" required="true" requiredMessage="#{bundle['myfoodsage.languagepreferred.required']}">
                                <f:selectItems value="#{enumLanguage.listItems}"/>
                            </h:selectOneMenu>
                            <p:message for="language"/>
                        </h:panelGrid>
                    </p:tab>

                    <p:tab id="tabTouristPersonalInfo" title="#{bundle['myfoodsage.personalinfo.tab']}">
                        <h:panelGrid  columns="3" cellpadding="5">
                            <h:outputLabel id="touristAccountNameLabel" value="#{bundle['myfoodsage.name.label']}" style="font-weight: bold"/>
                            <h:outputLabel id="name" value="#{touristEditMyFoodSageManagedBean.name}" />
                            <p:message for="username" />

                            <h:outputLabel id="touristAccountGenderLabel" value="#{bundle['myfoodsage.gender.label']}" style="font-weight: bold"/>
                            <h:outputLabel id="gender" value="#{touristEditMyFoodSageManagedBean.gender}" />
                            <p:message for="gender"/>

                            <h:outputLabel id="touristAccountBirthdateLabel" value ="#{bundle['myfoodsage.birthdate.label']}" style="font-weight: bold"/>
                            <h:outputText id="birthdate" value="#{touristEditMyFoodSageManagedBean.birthdate}" />
                            <p:message for="birthdate"/>

                            <h:outputLabel id="touristAccountCountryLabel" value ="#{bundle['myfoodsage.country.label']}" style="font-weight: bold"/>
                            <h:selectOneMenu id="country" value="#{touristEditMyFoodSageManagedBean.country}" required="true" requiredMessage="#{bundle['myfoodsage.country.required']}" >
                                <f:selectItems value="#{enumCountry.listItems}"/>
                            </h:selectOneMenu>
                            <p:message for="country"/>

                            <h:outputLabel id="touristAccountEmailLabel" value ="#{bundle['myfoodsage.email.label']}" style="font-weight: bold"/>
                            <h:outputText id="email" value="#{touristEditMyFoodSageManagedBean.email}" />
                            <p:message for="email"/>

                            <h:outputLabel id="touristAccountEmailSecondaryLabel" value ="#{bundle['myfoodsage.emailSecondary.label']}" style="font-weight: bold"/>
                            <p:inputText id="emailSecondary" value="#{touristEditMyFoodSageManagedBean.emailSecondary}">
                                <f:validator validatorId="checkValidEmail" />
                            </p:inputText>
                            <p:message for="emailSecondary"/>
                        </h:panelGrid>
                    </p:tab>

                    <p:tab id="tabTouristPersonalPref" title="#{bundle['myfoodsage.personalPref.tab']}">
                        <h:outputLabel id="touristCuisinePrefLabel" value ="#{bundle['myfoodsage.cuisinePref.label']}" style="font-weight: bold"/>
                        <h:selectManyCheckbox id="cuisinePref" layout="pageDirection" value="#{touristEditMyFoodSageManagedBean.cuisineTypeList}" converter="cuisineTypeConverter">
                            <f:selectItems value="#{enumCuisineType.listItems}" />
                        </h:selectManyCheckbox>
                        <p:message for="cuisinePref"/>

                        <h:outputLabel id="touristInterestPrefLabel" value ="#{bundle['myfoodsage.interestPref.label']}" style="font-weight: bold"/>
                        <h:selectManyCheckbox id="interestPref" layout="pageDirection" value="#{touristEditMyFoodSageManagedBean.interestList}" converter="interestConverter">
                            <f:selectItems value="#{enumInterest.listItems}" />
                        </h:selectManyCheckbox>
                        <p:message for="interestPref"/>
                    </p:tab>

                </p:tabView>

                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:commandButton id="myFoodsageUpdateButton" value="#{bundle['myfoodsage.update.button']}" update="touristAccountDetail" actionListener="#{touristEditMyFoodSageManagedBean.updateTouristDetails}" ajax="false" />
            </p:panel>
        </f:view>
    </ui:define>  
    
</ui:composition>
